package com.bdjk.bdmw.InfoGath.listener;

import javax.servlet.ServletContextEvent;

import org.apache.log4j.Logger;
import org.springframework.web.context.ContextLoaderListener;

import com.bdjk.bdmw.InfoGath.communication.server.tcp.netty.TCPServer;
import com.bdjk.bdmw.InfoGath.communication.server.tcp.socket.MainServer;


public class InfoGathListener extends ContextLoaderListener{
	private static final Logger logger = Logger.getLogger(InfoGathListener.class);
	
	@Override
	public void contextInitialized(ServletContextEvent event) {
		super.contextInitialized(event);
		// tomcat启动时，启动tcp服务
		//new Thread(new MainServer()).start();
		new Thread(new TCPServer()).start();
	}
	
	@Override
	public void contextDestroyed(ServletContextEvent event) {
		super.contextDestroyed(event);
		// tomcat关闭时，关闭tcp服务
		MainServer.shutDown();
	}
	
}
